<?php

declare(strict_types=1);

/**
 * @return ErrorCode 为空表示没有错误
 * @return ErrorCode 20011 k参数不能为空
 * @return ErrorCode 20012 v参数不能为空
 * @return ErrorCode 1001x 密钥无效
 */
/*require_once __DIR__ . '/key.php';

if (!$CONFIG['useCookies'] && empty($_POST['k'])) {
    echo json_encode([
        'ErrorCode'   =>   20011,
    ]);
    die();
}

$result = CheckKey(empty($_POST['k']) ? '' : $_POST['k']);
$array = json_decode($result, true);
if ($array['ErrorCode'] != 0) {
    echo $result;
    die();
}
*/
if (empty($_POST['v'])) {
    echo json_encode([
        'ErrorCode'   =>   20012,
    ]);
    die();
}

require_once __DIR__ . '/sysinfo.php';
$param = urldecode($_POST['v']);

$Sysinfo = new Sysinfo();
$data = $Sysinfo->GetDeviceInfo(json_decode($param, true));
echo json_encode($data);
